<template>
	<view class="app">
		<!-- <uni-nav-bar left-icon="back" @clickLeft="goBack" right-text="记录" @clickRight="backRight" title="签到"></uni-nav-bar> -->
		 <view class="page-body">
				<!-- <map style="width: 100%; height: 100vh;" > @markertap="makerTap"-->
				<map style="width: 100%; height: 100vh;" class="maps" :markers="markers" :scale="Number(scale)" :latitude="Number(latitude)"
				 :longitude="Number(longitude)" >
					<cover-image class="sign-work" src="@/static/img/signin.png" mode="" @click="signin"></cover-image>	
				</map>	
			
		</view>
	</view>
</template>

<script>
	import uniNavBar from "@/components/uni-nav-bar/uni-nav-bar.vue"
	import sign from "@/serve/api/sign.js"
	
	export default {
		components: {uniNavBar},
		data() {
			return {
				scale: "16", 
				markers: [], //当前定位
				latitude: "",
				longitude: "",
				addressDetails:"",	
					
				signList: [],
	
			}
		},
		onLoad(){
			let that = this;
			uni.getLocation({
			     type: 'gcj02',
				 geocode:true,
			     success:  function(res) {
					console.log(res)
					that.latitude = res.latitude
					that.longitude = res.longitude
					that.addressDetails = res.address.country+res.address.province+res.address.city+res.address.district+res.address.street+res.address.streetNum+res.address.poiName
					that.markers = [
						{
						  id: "currengInd",
						  latitude: res.latitude,
						  longitude: res.longitude,
					},
				  ];
			     },
			  });
		},
		
		methods: {
			// 导航返回事件
			goBack(){
				uni.navigateBack({
					
				})
			},
			// 签到
			async signin(){
				let parme = {
					
						latitude:this.latitude,
						longitude:this.longitude,
						addressDetails :this.addressDetails,
				}
				console.log(parme)
				const res = await sign.userSignClockSave(parme);
				console.log(res,"签到")
				if (res) {
					this.tip("签到成功")
				}
			},
		},
		// 导航记录事件
		onNavigationBarButtonTap(e){
			console.log(e)
			uni.navigateTo({
				url:"../signRcord/signRcord"
			})
		}
	}
</script>

<style scoped>
	*{
		margin: 0;
		padding: 0;
	}
	page{
		width: 750rpx;
		background-color: #F0F3F6;
	}
	/* .sign-div{
		width: 200rpx;
		height: 200rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
		border-radius: 50%;
		
	} */
	
	.app{
		position: relative;
	}
/* 	.page-body{
		position: absolute;
	} */
	.sign-div{
		position: fixed;
		/* top: 92rpx; */
		right: 0;
		left: 0;
		bottom: 52rpx;
	}
	.sign-work{
		width: 180rpx;
		height: 180rpx;
		background: linear-gradient(0deg, #017EFE, #00C0FA);
		border-radius: 50%;
		margin: 0 auto;
		text-align: center;
		line-height: 180rpx;
		color: #FFFFFF;
		font-size: 36rpx;
		position: absolute;
		bottom: 10%;
		left: 40%;
	}
</style>
